package com.iotechn.unimall.admin.api.article;

import com.baomidou.mybatisplus.extension.service.IService;
import com.dobbinsoft.fw.core.annotation.HttpMethod;
import com.dobbinsoft.fw.core.annotation.HttpOpenApi;
import com.dobbinsoft.fw.core.annotation.HttpParam;
import com.dobbinsoft.fw.core.annotation.HttpParamType;
import com.dobbinsoft.fw.core.annotation.param.NotNull;
import com.dobbinsoft.fw.core.annotation.param.Range;
import com.dobbinsoft.fw.core.exception.ServiceException;
import com.dobbinsoft.fw.support.model.Page;
import com.iotechn.unimall.data.domain.ArticleDO;
import com.iotechn.unimall.data.dto.ArticleDTO;
import com.iotechn.unimall.data.vo.TreeVO;

import java.util.List;

/**
 * 文章管理模块
 */
@HttpOpenApi(group = "admin.article", description = "文章管理")
public interface ArticleService extends IService<ArticleDO> {
    @HttpMethod(description = "分页查询", permission = "article:article:page", permissionParentName = "文章管理", permissionName = "通知文章")
    public Page<ArticleDTO> page(
            @HttpParam(name = "searchValue", type = HttpParamType.COMMON, description = "筛选条件") String searchValue,
            @HttpParam(name = "articleClassId", type = HttpParamType.COMMON, description = "父类目id") String articleClassId,
            @HttpParam(name = "status", type = HttpParamType.COMMON, description = "状态") Integer status,
            @HttpParam(name = "startTime", type = HttpParamType.COMMON, description = "开始时间") String startTime,
            @HttpParam(name = "endTime", type = HttpParamType.COMMON, description = "结束时间") String endTime,
            @Range(min = 1) @HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
            @Range(min = 1) @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer limit,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;


    @HttpMethod(description = "添加", permission = "article:article:create", permissionParentName = "文章管理", permissionName = "通知文章")
    public ArticleDTO create(
            @NotNull @HttpParam(name = "articleDO", type = HttpParamType.COMMON, description = "JSON数据") ArticleDO articleDO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "修改", permission = "article:article:edit", permissionParentName = "文章管理", permissionName = "通知文章")
    public ArticleDTO edit(
            @NotNull @HttpParam(name = "articleDO", type = HttpParamType.COMMON, description = "JSON数据") ArticleDO articleDO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "删除", permission = "article:article:delete", permissionParentName = "文章管理", permissionName = "通知文章")
    public String delete(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "文章ID") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "发布", permission = "article:article:issue", permissionParentName = "文章管理", permissionName = "通知文章")
    public String issue(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "文章ID") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

    @HttpMethod(description = "详情", permission = "article:article:detail", permissionParentName = "文章管理", permissionName = "通知文章")
    public ArticleDO detail(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "文章ID") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;


    @HttpMethod(description = "树级文章", permission = "article:article:tree", permissionParentName = "文章管理", permissionName = "通知文章")
    public List<TreeVO> tree(
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId) throws ServiceException;

}
